home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
pcfig4th.zip
/
4TH-LIB.MAC
< prev
next >
Wrap
Text File
|
1983-07-30
|
4KB
|
156 lines
.XLIST ;don't list as macros are loaded...
;======================================================================
; FORTH.ASM macro support
;======================================================================
_LINK = 0 ;;variable used to keep dictionary links
$FAIL MACRO MSG ;;Force an assembler error
%OUT ** &MSG
FORCED ERROR:&MSG ;;this will cause a syntax error, and print MSG
ENDM
;=======================================================================
; $NAME compile a Fig-FORTH name field
;=======================================================================
$NAME MACRO LBYTE, NAME, LASTCH
_NFA = $
DB LBYTE ;;length
IFNB <NAME>
DB '&NAME' ;;first part of name, except last char
ENDIF
DB '&LASTCH'+80H ;;last char has high bit set
ENDM
;=======================================================================
; $LINKS compile LFA, set _LINK to the NFA just set up by $NAME
;=======================================================================
$LINKS MACRO CFA, LABEL
IF _ALIGN ;;align LFA if _ALIGN is TRUE
EVEN
ENDIF
DW _LINK ;;LFA
_LINK = _NFA ;;will become next LFA in list
IFNB <LABEL>
LABEL: ;;label to be used in definitions
ENDIF
DW CFA
ENDM
;=======================================================================
; $CODE compile a code definition header
;=======================================================================
$CODE MACRO ONE, TWO, THREE, FOUR
$NAME ONE, TWO, THREE
$LINKS $+2, FOUR ;;CFA points to next address
ENDM
;=======================================================================
; $COLON compile a colon definition header
;=======================================================================
$COLON MACRO ONE, TWO, THREE, FOUR
$NAME ONE, TWO, THREE
$LINKS DOCOL, FOUR
ENDM
;=======================================================================
; $CONST compile a constant header
;=======================================================================
$CONST MACRO ONE, TWO, THREE, FOUR
$NAME ONE, TWO, THREE
$LINKS DOCON, FOUR
ENDM
;=======================================================================
; $VAR compile a variable header
;=======================================================================
$VAR MACRO ONE, TWO, THREE, FOUR
$NAME ONE, TWO, THREE
$LINKS DOVAR, FOUR
ENDM
;=======================================================================
; $USER compile a user variable header
;=======================================================================
$USER MACRO ONE, TWO, THREE, FOUR
$NAME ONE, TWO, THREE
$LINKS DOUSE, FOUR
ENDM
;=======================================================================
; $DOES compile a header for word defined by DOES>
;=======================================================================
$DOES MACRO ONE, TWO, THREE, FOUR
$NAME ONE, TWO, THREE
$LINKS DODOE, FOUR
ENDM
;=======================================================================
; $GOTO compile an absolute branch
;=======================================================================
$GOTO MACRO LABEL
DW BRAN
DW OFFSET LABEL-$
ENDM
;=======================================================================
; $GO?0 compile a relative branch
;=======================================================================
$GO?0 MACRO LABEL
DW ZBRAN
DW OFFSET LABEL-$
ENDM
;=======================================================================
; $LOOP compile a loop
;=======================================================================
$LOOP MACRO LABEL
DW XLOOP
DW OFFSET LABEL-$
ENDM
;=======================================================================
; $REPORT print a message if _REPORT is TRUE
;=======================================================================
$REPORT MACRO MESSAGE,VALUE
IF _REPORT
IF2
IFNB <VALUE>
%OUT MESSAGE&VALUE
ELSE
%OUT MESSAGE
ENDIF
ENDIF
ENDIF
ENDM
.LIST ;;start listing again